import { createRouter, createWebHistory, createWebHashHistory } from "vue-router";
import Layout from "@/layout/main.vue";
import { qiankunWindow } from "vite-plugin-qiankun/dist/helper";

const routes = [
  {
    path: "/",
    component: Layout,
    redirect: "/dept",
    children: [
      {
        path: "dept",
        name: "dept",
        component: () => import("@/views/dept/index.vue"),
      },
    ],
  },
];

const router = createRouter({
  routes,
  history: createWebHistory(qiankunWindow.__POWERED_BY_QIANKUN__ ? "/two-son" : ""),
});

/**
 * 全局前置守卫
 */
router.beforeEach((to, from) => {
  console.log(111);
});

export default router;
